package com.itheima.d01_io_char_reader;

import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;

public class test {
    public static void main(String[] args) throws IOException {
        //创建filereader对象，与磁盘文件关联
        try {
            FileReader fr = new FileReader("D:\\javabase_ws\\javaAdvanceProject\\day11_io\\src\\com\\itheima\\d01_io_char_reader\\kunkun.txt");
            //调用filereader对象的方法read()，把磁盘文件数据读入到内存中
//        int rs;
//        while ((rs = fr.read()) != -1){
//            System.out.print((char) rs);
//        }

//        System.out.println( fr.read());
//        System.out.println( fr.read());
//        System.out.println( fr.read());
//        System.out.println( fr.read());
            char[] chs = new char[1024];
            int len = -1;
            while ((len = fr.read(chs)) != -1){
                System.out.print(new String(chs,0,len));
            }
        } catch (IOException e) {
            throw new RuntimeException(e);
        }

    }
}
